<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<html>
<head>
    <title>书籍列表</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <!-- 引入 Bootstrap -->
    <link th:href="@{https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css}" rel="stylesheet">

</head>
<body>
<div class="container">
    <div class="row clearfix">
        <div class="col-md-12 column">
            <div class="page-header">
                <h1>
                    <small>书籍列表--显示所有书籍</small>
                </h1>
            </div>
        </div>
    </div>
    <div class="row">
        <div class="col-md-4 column">
            <a class="btn btn-primary" th:href="@{/book/toAddBook}">新增书籍</a>
            <a class="btn btn-primary" th:href="@{/book/allBook}">显示全部书籍</a>
        </div>
        <div class="col-md-4 column"></div>
        <div class="col-md-4 column">
            <form class="form-inline" th:action="@{/book/queryBook}" method="post"
                  style="float: right">
            <span style="color:red;font-weight: bold" th:text="${error}"></span>
                <input type="text" name="queryBookName" class="form-control"
                       placeholder="输入查询书名" required>
                <input type="submit" value="查询" class="btn btn-primary">
            </form>
        </div>

    </div>

    <div class="row clearfix">
        <div class="col-md-12 column">
            <table class="table table-hover table-striped">
                <thead>
                <tr>
                    <th>书籍编号</th>
                    <th>书籍名字</th>
                    <th>书籍数量</th>
                    <th>书籍详情</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                    <tr th:each="book : ${books}">
                        <td th:text="${book.bookID}"></td>
                        <td th:text="${book.bookName}"></td>
                        <td th:text="${book.bookCounts}"></td>
                        <td th:text="${book.detail}"></td>
                        <td>
                            <a th:href="@{/book/toUpdateBook(id=${book.bookID})}">更改</a> |
                            <a th:href="@{/book/deleteBook(id=${book.getBookID()})}"> 删除</a>
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
    </div>
</div>
</body>
</html>